package com.jinliang.blogweb.controller;

import com.jinliang.blogweb.entity.Article;
import com.jinliang.blogweb.entity.Comment;
import com.jinliang.blogweb.mapper.ArticleMapper;
import com.jinliang.blogweb.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "comment")
public class CommentController {

    @Autowired
    private CommentMapper commentMapper;

    @RequestMapping(value = "save")
    public Boolean save(@RequestBody Comment comment) {
        commentMapper.insert(comment);
        System.out.println(comment.toString());
        return Boolean.TRUE;
    }
    @RequestMapping(value = "get")
    public List<Comment> getList(@RequestBody Comment comment) {
        List<Comment> listByArticleId = commentMapper.getListByArticleId(comment);


        return listByArticleId;
    }
}
